{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "using DataFrames\n",
    "using Gadfly"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "benchmarks = readtable(\"benchmarks.csv\", names=[:language, :benchmark, :time])\n",
    "cdata = benchmarks[benchmarks[:language].== \"c\", :]\n",
    "benchmarks = join(benchmarks, cdata, on=:benchmark)\n",
    "benchmarks[:time]./= benchmarks[:time_1]\n",
    "benchmarks[:language] = PooledDataArray(benchmarks[:language])\n",
    "#benchmarks[:language] = reorder(benchmarks[:language], benchmarks[:time])\n",
    "benchmarks[:benchmark] = PooledDataArray(benchmarks[:benchmark])\n",
    "#benchmarks[:benchmark] = reorder(benchmarks[:benchmark], benchmarks[:time])\n",
    "benchmarks = benchmarks[benchmarks[:language].!= \"c\", :]\n",
    "benchmarks[:language] = setlevels!(benchmarks[:language], Dict{UTF8String,Any}(benchmarks[:language],\n",
    "  [ lang == \"javascript\" ? \"JavaScript\" : ucfirst(lang) for lang in benchmarks[:language]]));"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "p = plot(benchmarks,\n",
    "    x = :language,\n",
    "    y = :time,\n",
    "    color = :benchmark,\n",
    "    Scale.y_log10,\n",
    "    Guide.ylabel(nothing),\n",
    "    Guide.xlabel(nothing),\n",
    "    Theme(\n",
    "        default_point_size = 1mm,\n",
    "        guide_title_position = :left,\n",
    "        colorkey_swatch_shape = :circle,\n",
    "        minor_label_font = \"Georgia\",\n",
    "        major_label_font = \"Georgia\",\n",
    "    ),\n",
    ")\n",
    "draw(SVG(8inch,8inch/golden), p)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "draw(SVG(\"_includes/benchmarks.svg\", 8inch, 8inch/golden), p)"
   ]
  }
 ],
 "metadata": {
  "language": "Julia"
 },
 "nbformat": 4,
 "nbformat_minor": 0
}